package com.koko.mapper;

import com.github.pagehelper.Page;
import com.koko.annotation.AutoFill;
import com.koko.enumeration.OperationType;
import com.koko.game.dto.GameCardDTO;
import com.koko.game.dto.GameListPageQueryDTO;
import com.koko.game.dto.GamePageQueryDTO;
import com.koko.game.entity.Game;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface GameMapper {
    /**
     * 分页查询
     * @param gamePageQueryDTO
     * @return
     */
    Page<Game> pageQuery(GamePageQueryDTO gamePageQueryDTO);

    /**
     * 插入游戏信息
     * @param game
     */
    @AutoFill(OperationType.INSERT)
    void insert(Game game);

    /**
     * 删除游戏
     * @param id
     */
    void deleteById(Long id);

    /**
     * 更新游戏数据
     * @param game
     */
    @AutoFill(OperationType.UPDATE)
    void update(Game game);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    Game getById(Long id);

    List<Game> getByPublisherId(Long publisherId);

    List<Game> getCarouselData(GameCardDTO gameCardDTO);

    List<Game> getDiscountData(GameCardDTO gameCardDTO);

    Page<Game> getBaseGameData(GameListPageQueryDTO gameListPageQueryDTO);

    List<Game> getCarouselDataByCategoryId(GameCardDTO gameCardDTO);
}
